package com.siteseat.common.security;

import java.util.Set;

/**
 */
public interface SecurityManager {

  Credential authenticate( String name, String password, String clientId );

  boolean isAdministrator( String name ) throws SecurityException;

  boolean hasCredential( String name );

  void addCredential( String actor, Credential credential ) throws SecurityException;

  void removeCredential( String actor, String credentialName, String password ) throws SecurityException;

  void changePassword( String actor, String credentialName, String oldPassword, String newPassword )
          throws SecurityException;

  void ensureGranted( String actor, String resource, Permission permission ) throws SecurityException;

  boolean isGranted( String credentialName, String resource, Permission permission ) throws SecurityException;

  void grant( String actor, String credentialName, String resource, Permission permission ) throws SecurityException;

  void grant( String actor, String credentialName, String resource, Set<Permission> permissions ) throws SecurityException;

  void revoke( String actor, String credentialName, String resource, Permission permission ) throws SecurityException;

  void revoke( String actor, String credentialName, String resource, Set<Permission> permissions ) throws SecurityException;

}
